<%--
  Created by IntelliJ IDEA.
  User: wty
  Date: 2018/8/5 005
  Time: 11:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>注册嗨购</title>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/img/higou.png" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/common.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/top.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/regedit.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/jsp.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/swiper-4.3.3.min.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/bootstrap.css">
    <script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/swiper-4.3.3.min.js"></script>

</head>

<body>
<div id="header_container">
    <div id="logo">
        <img src="static/img/higou.png" id="logoimg">
        <div class="header_logo_box">
            <a href="#" rel="nofollow" class="top_link lightning" target="_blank"></a>
            <a href="#" rel="nofollow" class="top_link gild" target="_blank"></a>
            <a href="#" rel="nofollow" class="top_link credit" target="_blank"></a>
        </div>
    </div>
</div>

<div id="loginWrap" style="height: 476px; margin-bottom: 50px;">
    <div class="loginImage"></div>
    <div id="loginBord">
        <div id="r_login">
            <div class="loginTit">
                <div class="tosignup">已有账号
                    <a href="login.jsp">在此登录</a>
                </div>
                <h1>
                    <strong>用户注册</strong>
                </h1>
            </div>
            <br>
            <div  style="margin-left: 38px;text-align: center;">
                <form action="" method="post" class="bs-example bs-example-form" role="form">
                    <div class="input-group">
                        <span class="input-group-addon">手机号：</span>
                        <input type="text" name="u_tel" id="u_tel" class="form-control" placeholder="请输入11位手机号">
                    </div>
                    <br>
                    <div class="input-group">
                                <span class="input-group-addon">&nbsp;&nbsp;&nbsp;密码：</span>
                                <input type="password" name="u_pwd" id="u_pwd" class="form-control" placeholder="6-16字符建议使用字母加数字组合">
                    </div>                    <br>
                    <div class="input-group">
                                <span class="input-group-addon">&nbsp;&nbsp;&nbsp;重复：</span>
                                <input type="password" name="again" id="again" class="form-control" placeholder="请再次输入密码">
                    </div>

                    <hr/>
                    <div  style="padding: 5px 0;margin: 0 auto" class="btn-group " >
                        <button  type="submit" id="submit"class="btn btn-default">确定</button>
                        <button  type="reset"  id="reset" class="btn btn-default">重置</button>
                    </div>


        <div class="shadow_l"></div>
        <div class="shadow_r"></div>


</form>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $("#submit").click(function (e) {

    $.ajax({

        url: 'RegisterServlet.reg',
        type: 'POST',
        dataType: 'json',
        async: false,
        data: {
            u_tel: $('#u_tel').val(),
            u_pwd: $('#u_pwd').val(),
            again: $('#again').val()
        },
        success: function (data) {
            if (data.status === 'success') {
                alert('注册成功!请及时在\"我的嗨购\"绑定邮箱!');
                // location.href="index.jsp";
            }else if (data.status === 'fail') {
                alert('手机号已注册!');
                captchaObj.reset();
            }else if (data.status === 'againError') {
                alert('两次密码输入不一致')
                captchaObj.reset();
            }else if (data.status === 'noAgain') {
                alert('请输入确认密码!')

            }
        }
    })
    });
</script>

</html>
